The invention described herein generally relates to a process and apparatus for minimizing the consumption of energy in buildings using a computer controlled ventilation system. Specifically, it relates to the operation of commonly used gable or roof ventilation systems (for example, those using a gable fan or a roof fan in a residential, commercial, warehouse or manufacturing building) for maximum energy conservation. The invention can also be applied to commonly used uni-directional and bi-directional (reverse air) window fans. The invention will be particularly useful in warm dry desert-type climates like in Southern California, Nevada, Arizona, etc. where the average summer day-time temperature is much higher than the average summer night-time temperature.